<?php
$table1='data_user';
mysql_select_db($database_konek, $konek);
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$table1."'"))<1) {

mysql_select_db($database_konek, $konek);
$query_add = "CREATE TABLE data_user(
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`nama_user` VARCHAR( 30 ) NOT NULL ,
`pass` VARCHAR( 255 ) NOT NULL ,
`email` VARCHAR( 50 ) NOT NULL ,
`template` VARCHAR( 50 ) NOT NULL  ,
`nama_site` VARCHAR( 50 ) NOT NULL ,
`bio_site` VARCHAR( 255 ) NOT NULL
)";
$add = mysql_query($query_add, $konek) or die(mysql_error());

}

$table2='menu';
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$table2."'"))<1) {

mysql_select_db($database_konek, $konek);
$query_add2 = "CREATE TABLE menu(
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`judul_m` VARCHAR( 50 ) NOT NULL ,
`link_m` VARCHAR( 255 ) NOT NULL ,
`desk_m` VARCHAR( 255 ) NOT NULL ,
`sortir_m` INT( 11 ) NOT NULL  ,
`parent_m` INT( 11 ) NOT NULL ,
`kemana` INT( 1 ) NOT NULL,
`tipe_layout` INT( 11 ) NOT NULL
)";
$add2 = mysql_query($query_add2, $konek) or die(mysql_error());

}


$table3='plug_review';
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '".$table3."'"))<1) {

mysql_select_db($database_konek, $konek);
$query_add3 = "CREATE TABLE plug_review(
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`id_menu` VARCHAR( 15 ) NOT NULL ,
`konten_ke` INT( 11 ) NOT NULL ,
`plugin` VARCHAR( 255 ) NOT NULL ,
`sett` INT( 11 ) NOT NULL  
)";
$add3 = mysql_query($query_add3, $konek) or die(mysql_error());

}

mysql_select_db($database_konek, $konek);
$query_datanya_admin2 = "SELECT * FROM data_user";
$datanya_admin2 = mysql_query($query_datanya_admin2, $konek) or die(mysql_error());
$row_datanya_admin2 = mysql_fetch_assoc($datanya_admin2);
$totalRows_datanya_admin2 = mysql_num_rows($datanya_admin2);

if($totalRows_datanya_admin2==0){
	header('location: install/add_admin.php');
}

mysql_free_result($datanya_admin2);
?>